package cn.rkylin.oms.warehouse.extAdjust.vo;

import cn.rkylin.oms.warehouse.extAdjust.domain.Adjust;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * Created by Administrator on 2018-4-16.
 */
public class AdjustVO extends Adjust{

    private static final String STATUS_SONSHOW = "<span class=\"fadu fa fa-chevron-down\" adjustId=\"%s\" ></span>";
    private static final String STATUS_CHK = "<input name=\"chkAdjust\" adjustId=\"%s\" type=\"checkbox\" />";
    private static final String OPERATION_BTN_ADJUST = "<button onclick=\"adjust(\'%s\')\" adjustId=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\" pepid=\"adjustData\"><i class=\"fa fa-edit\" ></i>&nbsp;调整</button>";
    private static final String OPERATION_BTN_UPDATE = "<button onclick=\"updateAdjust(\'%s\')\" adjustId=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\" pepid=\"updateAdjust\"><i class=\"fa fa-edit\" ></i>&nbsp;修改</button>";
    private static final String OPERATION_BTN_UPDATE_DISABLE = "<button type=\"button\" class=\"btn btn-info btn-xs\" disabled><i class=\"fa fa-edit\" ></i>&nbsp;修改</button>";

    private String searchCondition;
    private Integer countWait;
    private Integer countComplete;
    private Integer countCancel;
    private String adjustTypeName;
    private String orderBy; // 画面排序
    private String sonShow;
    private String chk;
    private String operation;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTimeS;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTimeE;

    public Date getCreateTimeS() {
        return createTimeS;
    }

    public void setCreateTimeS(Date createTimeS) {
        this.createTimeS = createTimeS;
    }

    public Date getCreateTimeE() {
        return createTimeE;
    }

    public void setCreateTimeE(Date createTimeE) {
        this.createTimeE = createTimeE;
    }

    public String getOperation() {
        StringBuffer opButton = new StringBuffer();
        opButton.append(String.format(OPERATION_BTN_ADJUST, getAdjustId(), getAdjustId()));
        opButton.append("&nbsp;");

        if ("sd".equals(this.getAdjustType())){
            opButton.append(String.format(OPERATION_BTN_UPDATE, getAdjustId(), getAdjustId()));
            opButton.append("&nbsp;");
        } else {
            opButton.append(String.format(OPERATION_BTN_UPDATE_DISABLE));
            opButton.append("&nbsp;");
        }


        return opButton.toString();
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public String getChk() {
        return String.format(STATUS_CHK, this.getAdjustId()).toString();
    }

    public void setChk(String chk) {
        this.chk = chk;
    }

    public String getSonShow() {
        return String.format(STATUS_SONSHOW, this.getAdjustId()).toString();
    }

    public void setSonShow(String sonShow) {
        this.sonShow = sonShow;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getAdjustTypeName() {
        if ("pd".equals(this.getAdjustType())){
            return "盘点调整";
        } else {
            return "手动调整";
        }
    }

    public void setAdjustTypeName(String adjustTypeName) {
        this.adjustTypeName = adjustTypeName;
    }

    public String getSearchCondition() {
        return searchCondition;
    }

    public void setSearchCondition(String searchCondition) {
        this.searchCondition = searchCondition;
    }

    public Integer getCountWait() {
        return countWait;
    }

    public void setCountWait(Integer countWait) {
        this.countWait = countWait;
    }

    public Integer getCountComplete() {
        return countComplete;
    }

    public void setCountComplete(Integer countComplete) {
        this.countComplete = countComplete;
    }

    public Integer getCountCancel() {
        return countCancel;
    }

    public void setCountCancel(Integer countCancel) {
        this.countCancel = countCancel;
    }
}
